import { getAction, deleteAction, putAction, postAction, httpAction, fromDataPostAction, fromDataPostActionMultipart } from '@/api/manage'
import Vue from 'vue'

//图片
const addCommonUpload = (params) => fromDataPostActionMultipart("/sys/common/upload", params)//新增表
const pmProjectId = (params) => getAction("/finance/pmOperateReimbursementPayment/queryById", params)//新增表
//项目包详情
const packageBoard = (params) => getAction("/project/pmProject/packageBoard", params)//新增表



//
// 
//费用提交 //编辑

//库表设计
const sqlFormTable = (params) => getAction("/design/desTable/list", params)//查询表
const sqlFormGetById = (params) => getAction("/design/desTable/queryById", params)//通过id查询表
const addNewFrom = (params) => postAction("/design/desTable/add", params)//新增表
const designFrom = (params) => putAction("/design/desTable/edit", params)//编辑表
const deleteBatch = (params) => getAction("/design/desTable/delteTable", params)//编辑表


//列表设计
const sqlDesList = (params) => getAction("/design/desList/list", params)//查询表
const sqlDesListById = (params) => getAction("/design/desList/queryById", params)//查询表
const addDesList = (params) => postAction("/design/desList/add", params)//添加表
const deleteDeslist = (params) => deleteAction("/design/desList/deleteBatch", params)//删除多个
const deleteDeslistItem = (params) => deleteAction("/design/desList/delete", params)//删除单个
const editDeslist = (params) => putAction("/design/desList/edit", params)//编辑列表
const generateInterfaceDesList = (params) => fromDataPostAction("/design/desList/generateInterface", params)//接口生成


// 表单
const sqlDesForm = (params) => getAction("/design/desForm/list", params)//查询表单
const addDesForm = (params) => postAction("/design/desForm/add", params)//添加表单
const sqlDesFormById = (params) => getAction("/design/desForm/queryById", params)//查询表
const editDesForm = (params) => putAction("/design/desForm/edit", params)//编辑表单
const deleteDesFormItem = (params) => deleteAction("/design/desForm/delete", params)//删除单个
const deleteDesForm = (params) => deleteAction("/design/desForm/deleteBatch", params)//删除多个
const generateInterfaceDesForm = (params) => fromDataPostAction("/design/desForm/generateInterface", params)//接口生成


//报表
const sqlDesReport = (params) => getAction("/design/desReport/list", params)//查询表
const addDesReport = (params) => postAction("/design/desReport/add", params)//添加表单
const editDesReport = (params) => putAction("/design/desReport/edit", params)//编辑表单
const sqlDesReportById = (params) => getAction("/design/desReport/queryById", params)//查询表
const deleteDesReportlist = (params) => deleteAction("/design/desReport/deleteBatch", params)//删除多个
const deleteDesReportItem = (params) => deleteAction("/design/desReport/delete", params)//删除单个
const getDesInterface = (params) => getAction("/design/desInterface/list", params)//查询接口列表




//接口设计
const sqlDesInterface = (params) => getAction("/design/desInterface/list", params)//查询表

const addDesInterface = (params) => postAction("/design/desInterface/add", params)//添加表单
const deleteDesInterface = (params) => deleteAction("/design/desInterface/delete", params)//删除单个
const editDesInterface = (params) => putAction("/design/desInterface/edit", params)//编辑表单
const editDesInterfaceopen = (params) => putAction("/design/desInterface/editDesInterface", params)//编辑表单
const sqlDesInterfaceById = (params) => getAction("/design/desInterface/queryById", params)//查询表
const deleteInterfacelist = (params) => deleteAction("/design/desInterface/deleteBatch", params)//删除多个






// 查询表单是否开启审批
const getEnableOne = (params) => getAction("/sys/sysEntityProc/getEnableOne", params);






//角色管理
const addRole = (params) => postAction("/sys/role/add", params);
const editRole = (params) => putAction("/sys/role/edit", params);
const checkRoleCode = (params) => getAction("/sys/role/checkRoleCode", params);
const queryall = (params) => getAction("/sys/role/queryall", params);

//用户管理
const addUser = (params) => postAction("/sys/user/add", params);
const editUser = (params) => putAction("/sys/user/edit", params);
const queryUserRole = (params) => getAction("/sys/user/queryUserRole", params);
const getUserList = (params) => getAction("/sys/user/list", params);
const frozenBatch = (params) => putAction("/sys/user/frozenBatch", params);
//验证用户是否存在
const checkOnlyUser = (params) => getAction("/sys/user/checkOnlyUser", params);
//改变密码
const changePassword = (params) => putAction("/sys/user/changePassword", params);

//权限管理
const addPermission = (params) => postAction("/sys/permission/add", params);
const editPermission = (params) => putAction("/sys/permission/edit", params);
const getPermissionList = (params) => getAction("/sys/permission/list", params);
const getSystemMenuList = (params) => getAction("/sys/permission/getSystemMenuList", params);
const getSystemSubmenu = (params) => getAction("/sys/permission/getSystemSubmenu", params);
const getSystemSubmenuBatch = (params) => getAction('/sys/permission/getSystemSubmenuBatch', params)
const queryTreeList = (params) => getAction("/sys/permission/queryTreeList", params);
const queryTreeListForRole = (params) => getAction("/sys/role/queryTreeList", params);
const queryListAsync = (params) => getAction("/sys/permission/queryListAsync", params);
const queryRolePermission = (params) => getAction("/sys/permission/queryRolePermission", params);
const saveRolePermission = (params) => postAction("/sys/permission/saveRolePermission", params);
const queryPermissionsByUser = (params) => getAction("/newSys/permission/getUserPermissionByToken?menuFlag=2", params);
const loadAllRoleIds = (params) => getAction("/sys/permission/loadAllRoleIds", params);
const getPermissionRuleList = (params) => getAction("/sys/permission/getPermRuleListByPermId", params);
const queryPermissionRule = (params) => getAction("/sys/permission/queryPermissionRule", params);

// 部门管理
const queryDepartTreeList = (params) => getAction("/sys/sysDepart/queryTreeList", params);
const queryIdTree = (params) => getAction("/sys/sysDepart/queryIdTree", params);
const queryParentName = (params) => getAction("/sys/sysDepart/queryParentName", params);
const searchByKeywords = (params) => getAction("/sys/sysDepart/searchBy", params);
const deleteByDepartId = (params) => deleteAction("/sys/sysDepart/delete", params);

//二级部门管理
const queryDepartPermission = (params) => getAction("/sys/permission/queryDepartPermission", params);
const saveDepartPermission = (params) => postAction("/sys/permission/saveDepartPermission", params);
const queryTreeListForDeptRole = (params) => getAction("/sys/sysDepartPermission/queryTreeListForDeptRole", params);
const queryDeptRolePermission = (params) => getAction("/sys/sysDepartPermission/queryDeptRolePermission", params);
const saveDeptRolePermission = (params) => postAction("/sys/sysDepartPermission/saveDeptRolePermission", params);
const queryMyDepartTreeList = (params) => getAction("/sys/sysDepart/queryMyDeptTreeList", params);

//日志管理
//const getLogList = (params)=>getAction("/sys/log/list",params);
const deleteLog = (params) => deleteAction("/sys/log/delete", params);
const deleteLogList = (params) => deleteAction("/sys/log/deleteBatch", params);

//数据字典
const addDict = (params) => postAction("/sys/dict/add", params);
const editDict = (params) => putAction("/sys/dict/edit", params);
const treeList = (params) => getAction("/sys/dict/treeList", params);
const addDictItem = (params) => postAction("/sys/dictItem/add", params);
const editDictItem = (params) => putAction("/sys/dictItem/edit", params);

//字典标签专用（通过code获取字典数组）
export const ajaxGetDictItems = (code, params) => getAction(`/sys/dict/getDictItems/${code}`, params);
//从缓存中获取字典配置
const getUserDeparts = (params) => getAction("/sys/user/getUserDeparts", params);

//申请
const getMyProject = (params) => getAction("/project/pmProject/getMyProject", params);
const pmUserAccount = (params) => getAction("/finance/pmUserAccount/queryByUserId", params);

const queryTreeByProjectId = (params) => getAction("/project/pmProjectCostBudget/queryTreeByProjectId", params);
const pmLoanPaymentList = (params) => getAction("/finance/pmLoanPayment/queryList", params);
const pmOperateReimbursementPaymentpost = (params) => postAction("/finance/pmOperateReimbursementPayment/add", params)//新增表
const pmOperateReimbursementPaymentput = (params) => putAction("/finance/pmOperateReimbursementPayment/edit", params)//新增表

const pmSupplieradd = (params) => postAction("/project/pmSupplier/add", params)
const pmSupplieredit = (params) => putAction("/project/pmSupplier/edit", params)
const dictItemSupplier = (params) => getAction("/sys/dictItem/list?dictId=1377544916486012930", params);


// 
//账户看板



const accountOverageCount = (params) => getAction("/finance/pmCompanyAccount/accountOverageCount", params);

const selectAccountFlowList = (params) => getAction("/finance/pmFinancialFlow/selectAccountFlowList", params);

const getFinancialFlow = (params) => getAction("/finance/pmFinancialFlow/list", params);

//项目列表

const queryPmSupplierAccountByMainId = (params) => getAction("/project/pmSupplier/queryPmSupplierAccountByMainId", params);
const getProjectList = (params) => getAction("/inner/api/auto_queryList_pm_project_g2bS", params);
const queryProjectAmountIncome = (params) => getAction("/project/pmProject/queryProjectAmountIncome", params);
const queryProjectCostBudget = (params) => getAction("/project/pmProject/queryProjectCostBudget", params);
const queryProjectCost = (params) => getAction("/project/pmProject/queryProjectCost", params);
//总计
const queryProjectProfitCount = (params) => getAction("/project/pmProject/queryProjectProfitCount", params);
//列表
const queryProjectProfitPage = (params) => getAction("/project/pmProject/queryProjectProfitPage", params);


const dingtalkAuthCode = (params) => getAction("/dingtalk/auth2/login", params);

//系统通告
const doReleaseData = (params) => getAction("/sys/annountCement/doReleaseData", params);
const doReovkeData = (params) => getAction("/sys/annountCement/doReovkeData", params);
//获取系统访问量
const getLoginfo = (params) => getAction("/sys/loginfo", params);
const getVisitInfo = (params) => getAction("/sys/visitInfo", params);

// 根据部门主键查询用户信息
const queryUserByDepId = (params) => getAction("/sys/user/queryUserByDepId", params);

// 重复校验
const duplicateCheck = (params) => getAction("/sys/duplicate/check", params);
// 加载分类字典
const loadCategoryData = (params) => getAction("/sys/category/loadAllData", params);
const checkRuleByCode = (params) => getAction('/sys/checkRule/checkByCode', params)
//加载我的通告信息
const getUserNoticeInfo = (params) => getAction("/sys/sysAnnouncementSend/getMyAnnouncementSend", params);
const getTransitURL = url => `/sys/common/transitRESTful?url=${encodeURIComponent(url)}`
//验证名字重复
const checkOnlyTable = (params) => getAction("/design/desTable/checkOnlyTable", params);
const getProjectLists = (params) => getAction("/project/pmProject/getProjectList", params);
// 草稿操作接口
const saveDraft = (params) => putAction("/pm/draft/save", params);
const delDraft = (params) => deleteAction("/pm/draft/del", params);
const getDraft = (params) => getAction("/pm/draft/get", params);
// 供应商弹框列表查询
const pageQuerySupplier = (params) => getAction('/project/pmSupplier/pageQuerySupplier', params);

// http://223.240.94.226:8100/jeecg-boot?packageId=bbe82257356aefbab4296e1d67d66104&_t=1626831951
// 中转HTTP请求
export const transitRESTful = {
  get: (url, parameter) => getAction(getTransitURL(url), parameter),
  post: (url, parameter) => postAction(getTransitURL(url), parameter),
  put: (url, parameter) => putAction(getTransitURL(url), parameter),
  http: (url, parameter) => httpAction(getTransitURL(url), parameter),
}
//根据ID查用户
const getSelectListByIds = (params) => getAction("/sys/user/selectListByIds", params);
//根据角色查询用户
const getRoleNotContainsMe = (params) => getAction("/proc/UserAndDept/queryUserBatchByRoleNotContainsMe", params);
//根据角色查询用户
const getUserPersonInfo = (params) => getAction("/sys/user/getUserPersonInfo", params);
export {
  getRoleNotContainsMe,
  getSelectListByIds,
  saveDraft,
  delDraft,
  getDraft,
  pageQuerySupplier,
  getProjectLists,
  queryProjectProfitCount,
  queryProjectProfitPage,
  queryProjectCost,
  queryProjectCostBudget,
  queryProjectAmountIncome,
  pmProjectId,
  packageBoard,
  addCommonUpload,
  checkOnlyTable,
  sqlFormTable,
  sqlFormGetById,
  addNewFrom,
  designFrom,
  deleteBatch,
  sqlDesList,
  addDesList,
  deleteDeslist,
  editDeslist,
  deleteDeslistItem,
  sqlDesForm,
  sqlDesListById,
  addDesForm,
  sqlDesFormById,
  editDesForm,
  deleteDesFormItem,
  deleteDesForm,
  sqlDesReport,
  addDesReport,
  editDesReport,
  sqlDesReportById,
  deleteDesReportlist,
  deleteDesReportItem,
  getDesInterface,
  generateInterfaceDesList,
  generateInterfaceDesForm,
  sqlDesInterface,
  addDesInterface,
  deleteDesInterface,
  editDesInterface,
  sqlDesInterfaceById,
  deleteInterfacelist,
  editDesInterfaceopen,

  getEnableOne,


  addRole,
  editRole,
  checkRoleCode,
  addUser,
  editUser,
  queryUserRole,
  getUserList,
  queryall,
  frozenBatch,
  checkOnlyUser,
  changePassword,
  getPermissionList,
  addPermission,
  editPermission,
  queryTreeList,
  queryListAsync,
  queryRolePermission,
  saveRolePermission,
  queryPermissionsByUser,
  loadAllRoleIds,
  getPermissionRuleList,
  queryPermissionRule,
  queryDepartTreeList,
  queryIdTree,
  queryParentName,
  searchByKeywords,
  deleteByDepartId,
  deleteLog,
  deleteLogList,
  addDict,
  editDict,
  treeList,
  addDictItem,
  editDictItem,
  dingtalkAuthCode,
  getFinancialFlow,
  accountOverageCount,
  selectAccountFlowList,
  getProjectList,
  queryPmSupplierAccountByMainId,
  doReleaseData,
  doReovkeData,
  getLoginfo,
  getVisitInfo,
  queryUserByDepId,
  duplicateCheck,
  queryTreeListForRole,
  getSystemMenuList,
  getSystemSubmenu,
  getSystemSubmenuBatch,
  loadCategoryData,
  checkRuleByCode,
  queryDepartPermission,
  saveDepartPermission,
  queryTreeListForDeptRole,
  queryDeptRolePermission,
  saveDeptRolePermission,
  queryMyDepartTreeList,
  getUserNoticeInfo,

  getMyProject,
  pmUserAccount,
  queryTreeByProjectId,
  pmLoanPaymentList,
  pmOperateReimbursementPaymentpost,
  pmOperateReimbursementPaymentput,
  pmSupplieradd,
  pmSupplieredit,
  dictItemSupplier,
  getUserDeparts,

  getUserPersonInfo
}



